package com.changgou.search.listener;

import com.changgou.search.config.RabbitMQConfig;
import com.changgou.search.service.EsManagerService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Author: 陈安
 * @Date: 2020/12/10$ 20:28$
 * @Description: $todo$
 * @Version 1.0
 */
@Component
public class GoodsUpListener {

    @Autowired
    private EsManagerService esManagerService;

    @RabbitListener(queues = RabbitMQConfig.SEARCH_ADD_QUEUE)
    public void receiveMessage(String spuId) {
        System.out.println("接收到的信息为" + spuId);
        //监听到队列的spuid了才导入
        esManagerService.importDataToESBySpuId(spuId);
    }

}
